package gti310.tp4;

public class Quantification {
	static public int[][] quantifierY(double[][] matrix, int fq) {
		// O(n^2)
		int[][] matrixQ = new int[matrix.length][matrix.length];
		for (int i = 0; i < matrix.length; i++) {
			for (int j = 0; j < matrix.length; j++) {
				matrixQ[i][j] = (int) Math.round((matrix[i][j] / TableQ.QY(i,
						j, fq)));
			}
		}
		return matrixQ;
	}

	static public double[][] deQuantifierY(double[][] matrix, int fq) {
		// O(n^2)
		double[][] matrixQ = new double[matrix.length][matrix.length];
		for (int i = 0; i < matrix.length; i++) {
			for (int j = 0; j < matrix.length; j++) {
				matrixQ[i][j] = (int) Math.round((matrix[i][j] * TableQ.QY(i,
						j, fq)));
			}
		}
		return matrixQ;
	}

	static public int[][] quantifierUV(double[][] matrix, int fq) {
		// O(n^2)
		int[][] matrixQ = new int[matrix.length][matrix.length];
		for (int i = 0; i < matrix.length; i++) {
			for (int j = 0; j < matrix.length; j++) {
				matrixQ[i][j] = (int) Math.round((matrix[i][j] / TableQ.QUV(i,
						j, fq)));
			}
		}
		return matrixQ;
	}

	static public double[][] deQuantifierUV(double[][] matrix, int fq) {
		// O(n^2)
		double[][] matrixQ = new double[matrix.length][matrix.length];
		for (int i = 0; i < matrix.length; i++) {
			for (int j = 0; j < matrix.length; j++) {
				matrixQ[i][j] = (int) Math.round((matrix[i][j] * TableQ.QUV(i,
						j, fq)));
			}
		}
		return matrixQ;
	}

}
